package com.wisezone.HomeWork.home0218;

import com.wisezone.demo0217.Person;

import java.lang.reflect.Field;

public class Test03 {
    public void test1() throws Exception{
        Class  clazz = Person.class;
        //1.getFields() 只能获取到运行时类中声明为public的属性
        Field[] fileds = clazz.getFields();
        for (Field field : fileds){
            System.out.println(field);
        }
        System.out.println("----------------------------");
        //2.getDeclatedFields(): 获取运行时类声明的所有的属性
        fileds = clazz.getDeclaredFields();
        for (Field field : fileds){
            System.out.println(field);
        }



    }
}
